<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
    <button id="btn" onclick="getLok()" value="按钮">按钮</button>
    <p id="href">hello</p>
    <script>
        function getLok(){
            document.getElementById("href").innerHTML=window.location.href;
        }
    </script>
</body>
</html>